package com.example.service.impl;

import com.example.dao.FoodsCategoryDao;
import com.example.entity.FoodsCategory;
import com.example.service.FoodsCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class FoodsCategoryServiceImpl implements FoodsCategoryService {

    @Autowired
    private FoodsCategoryDao foodsCategoryDao;

    @Override
    @Transactional
    public int addFoodsCategory(FoodsCategory category) {
        return foodsCategoryDao.addFoodsCategory(category);
    }

    @Override
    @Transactional
    public int deleteFoodsCategory(Integer categoryId) {
        return foodsCategoryDao.deleteFoodsCategory(categoryId);
    }

    @Override
    @Transactional
    public int updateFoodsCategory(FoodsCategory category) {
        return foodsCategoryDao.updateFoodsCategory(category);
    }

    @Override
    public FoodsCategory getFoodsCategoryById(Integer categoryId) {
        return foodsCategoryDao.getFoodsCategoryById(categoryId);
    }

    @Override
    public List<FoodsCategory> getAllFoodsCategories() {
        return foodsCategoryDao.getAllFoodsCategories();
    }
}